package input_output;

import org.apache.log4j.Logger;

import simulators.MessageOutbox;
import types.TextMessage;
import config.ConfigData;

public class OutboxWorker
{
    private static Logger myLogger = Logger.getLogger(OutboxWorker.class.getName());
    
    /**
     * Sends message to a phone number. 
     * Should be threaded or called by a thread that will not hold up other operations.
     * 
     * @param fromPhone
     * @param msgError
     */
    public static void sendMessage(String fromPhone, String msgError)
    {
	// Real mode
	if (! ConfigData.isTestMode())
	{
	    
	}
	// Test mode
	else
	{
	    TextMessage tm = new TextMessage(fromPhone,msgError);
	    myLogger.info("Adding message for sending: " + tm);
	    MessageOutbox.addMessage(tm);
	}
	
    }
    
}
